/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.passive;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.BCD;
import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.BIN;

/**
 * <b>(DianlanChargingFinish)</b>
 * <p>
 * 充电结束,GBT-27930 充电桩与 BMS 充电结束阶段报文
 * 帧类型码 0x19
 * 序列号域 0015
 * 数据长度 77
 * 帧校验域 AE36
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/19
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanChargingFinish {
    /** 交易流水号 */
    @DianlanProtocol(length = 16, start = 0, end = 16, dataType = BCD)
    String transNo;
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 16, end = 23, dataType = BCD)
    String stubNo;
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 23, end = 24, dataType = BCD)
    String chargingPortNo;
    /** BMS 中止荷电状态 SOC 1%/位，0%偏移量；数据范围：0~100% */
    @DianlanProtocol(length = 1, start = 24, end = 25, dataType = BIN)
    String abortChargeState;
    /** BMS 动力蓄电池单体最高电压 0.01 V/位，0 V 偏移量； 数据范围：0~24 V */
    @DianlanProtocol(length = 2, start = 25, end = 27, dataType = BIN)
    String powerBatteryMiniVoltage;
    /** BMS 动力蓄电池单体最低电压 0.01 V/位，0 V 偏移量； 数据范围：0~24 V */
    @DianlanProtocol(length = 2, start = 27, end = 29, dataType = BIN)
    String powerBatteryMaxVoltage;
    /** BMS 动力蓄电池最低温度 1ºC/位，-50 ºC 偏移量；数据范围：-50 ºC ~+200 ºC */
    @DianlanProtocol(length = 1, start = 29, end = 30, dataType = BIN)
    String powerBatteryMiniTemperature;
    /** BMS 动力蓄电池最高温度 1ºC/位，-50 ºC 偏移量；数据范围：-50 ºC ~+200 ºC */
    @DianlanProtocol(length = 1, start = 30, end = 31, dataType = BIN)
    String powerBatteryMaxTemperature;
    /** 累计充电时间 1 min/位，0 min 偏移量；数据范围：0~600 min */
    @DianlanProtocol(length = 2, start = 31, end = 33, dataType = BIN)
    String cumulativeChargingTime;
    /** 电桩输出能量 0.1 kWh/位，0 kWh 偏移量；数据范围：0~1000 kWh */
    @DianlanProtocol(length = 2, start = 33, end = 35, dataType = BIN)
    String outputEnergy;
    /** 电桩充电机编号 充 电 机编 号， 1/ 位， 1 偏移量 ，数 据范 围 ： 0 ～0xFFFFFFFF */
    @DianlanProtocol(length = 4, start = 35, end = 39, dataType = BIN)
    String batteryChargerNo;
}